package web.fabrimind.sm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.sm.mapper.ShiftScheduleMapper;
import web.fabrimind.sm.domain.ShiftSchedule;
import web.fabrimind.sm.service.IShiftScheduleService;

/**
 * 班次排班Service业务层处理
 * 
 * @author zhihui
 * @date 2025-03-30
 */
@Service
public class ShiftScheduleServiceImpl implements IShiftScheduleService 
{
    @Autowired
    private ShiftScheduleMapper shiftScheduleMapper;

    /**
     * 查询班次排班
     * 
     * @param scheduleId 班次排班主键
     * @return 班次排班
     */
    @Override
    public ShiftSchedule selectShiftScheduleByScheduleId(Long scheduleId)
    {
        return shiftScheduleMapper.selectShiftScheduleByScheduleId(scheduleId);
    }

    /**
     * 查询班次排班列表
     * 
     * @param shiftSchedule 班次排班
     * @return 班次排班
     */
    @Override
    public List<ShiftSchedule> selectShiftScheduleList(ShiftSchedule shiftSchedule)
    {
        return shiftScheduleMapper.selectShiftScheduleList(shiftSchedule);
    }

    /**
     * 新增班次排班
     * 
     * @param shiftSchedule 班次排班
     * @return 结果
     */
    @Override
    public int insertShiftSchedule(ShiftSchedule shiftSchedule)
    {
        shiftSchedule.setCreateTime(DateUtils.getNowDate());
        return shiftScheduleMapper.insertShiftSchedule(shiftSchedule);
    }

    /**
     * 修改班次排班
     * 
     * @param shiftSchedule 班次排班
     * @return 结果
     */
    @Override
    public int updateShiftSchedule(ShiftSchedule shiftSchedule)
    {
        shiftSchedule.setUpdateTime(DateUtils.getNowDate());
        return shiftScheduleMapper.updateShiftSchedule(shiftSchedule);
    }

    /**
     * 批量删除班次排班
     * 
     * @param scheduleIds 需要删除的班次排班主键
     * @return 结果
     */
    @Override
    public int deleteShiftScheduleByScheduleIds(Long[] scheduleIds)
    {
        return shiftScheduleMapper.deleteShiftScheduleByScheduleIds(scheduleIds);
    }

    /**
     * 删除班次排班信息
     * 
     * @param scheduleId 班次排班主键
     * @return 结果
     */
    @Override
    public int deleteShiftScheduleByScheduleId(Long scheduleId)
    {
        return shiftScheduleMapper.deleteShiftScheduleByScheduleId(scheduleId);
    }


    /**
     * 查询所属团队名称列表（不分页）
     */
    @Override
    public List<ShiftSchedule> selectShiftList(ShiftSchedule shiftSchedule) {
        return shiftScheduleMapper.selectShiftList(shiftSchedule);
    }
}
